<!DOCTYPE html>
<html debug="true">
  <head>
    <script type="text/javascript" src="../../../../lib/externals/openlayers/lib/OpenLayers.js"></script>
    <script type="text/javascript" src="../../../../lib/externals/ext/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="../../../../lib/externals/ext/ext-all-debug.js"></script>

    <script type="text/javascript" src="../../GEOR_config.js"></script>
    <script type="text/javascript">
    function test_GetBaseURL(t) {
        t.plan(10);

        var url, base, o = GEOR.config;

        url = "http://foo.bar/foo/bar";
        base = o._getBaseURL(url);
        t.eq(base, "../",
             "getBaseURL returns expected value (" + url + ")");

        url = "http://foo.bar:8080/foo/bar";
        base = o._getBaseURL(url);
        t.eq(base, "../",
             "getBaseURL returns expected value (" + url + ")");

        url = "http://foo.bar.wrk.cby/foo/bar";
        base = o._getBaseURL(url);
        t.eq(base,
             "http://drebretagne-geobretagne.int.lsn.camptocamp.com/",
             "getBaseURL returns expected value (" + url + ")");

        url = "http://foo.bar.wrk.cby:8080/foo/bar";
        base = o._getBaseURL(url);
        t.eq(base,
             "http://drebretagne-geobretagne.int.lsn.camptocamp.com/",
             "getBaseURL returns expected value (" + url + ")");

        url = "http://foo.bar.wrk.lsn/foo/bar";
        base = o._getBaseURL(url);
        t.eq(base,
             "http://drebretagne-geobretagne.int.lsn.camptocamp.com/",
             "getBaseURL returns expected value (" + url + ")");

        url = "http://foo.bar.wrk.lsn:8080/foo/bar";
        base = o._getBaseURL(url);
        t.eq(base,
             "http://drebretagne-geobretagne.int.lsn.camptocamp.com/",
             "getBaseURL returns expected value (" + url + ")");

        url = "http://10.26.10.38";
        base = o._getBaseURL(url);
        t.eq(base,
             "http://drebretagne-geobretagne.int.lsn.camptocamp.com/",
             "getBaseURL returns expected value (" + url + ")");

        url = "http://10.26.10.38:8080";
        base = o._getBaseURL(url);
        t.eq(base,
             "http://drebretagne-geobretagne.int.lsn.camptocamp.com/",
             "getBaseURL returns expected value (" + url + ")");

        url = "http://drebretagne-geobretagne.int.lsn.camptocamp.com/extractorapp/";
        base = o._getBaseURL(url);
        t.eq(base,
             "../",
             "getBaseURL returns expected value (" + url + ")");

        url = "http://drebretagne-geobretagne.demo-camptocamp.com/extractorapp/";
        base = o._getBaseURL(url);
        t.eq(base,
             "../",
             "getBaseURL returns expected value (" + url + ")");
    }
    function test_GetAppURL(t) {
        t.plan(3);

        var url, base, o = GEOR.config;

        url = "http://foo.bar/foo/bar";
        base = o._getAppURL(url);
        t.eq(base, "http://foo.bar/foo/bar",
             "getAppURL returns expected value (" + url+ ")");

        url = "http://foo.bar:8080/foo/bar";
        base = o._getAppURL(url);
        t.eq(base, "http://foo.bar:8080/foo/bar",
             "getAppURL returns expected value (" + url + ")");

        url = "http://foo.bar/foo/bar?foo=bar&bar=foo";
        base = o._getAppURL(url);
        t.eq(base, "http://foo.bar/foo/bar",
             "getAppURL returns expected value (" + url+ ")");
    }
    </script>
  </head>

  <body>
    <div class="sample" id="sample_id">some text</div>
  </body>
</html>
